$(".select-box").click(function(){
    var input=$(this).children('input');
    var ul=$(this).children("ul");
    ul.toggleClass('hide');
    ul.on("click","li",function(){
        input.val($(this).html());
    })
});
$(".area").click(function(){
    var input=$(this).children('input');
    $(this).children(".province").removeClass('hide');
});
$(".province").on('click','li',function(){
    var province=$(this).html();
    var city_block=$(this).parent().siblings('.city');
    $.ajax({
        type:'get',
        url:'',
        data:{},
        success:function(data){

        },
        error:function(){

        }
    });
    city_block.removeClass('hide');
});
$(".city").on('click','li',function(event){
    var city=$(this).html();
    console.log(city);
    $(".area input").val(city);
    $(".area").children('.province').addClass('hide');
    $(".area").children('.city').addClass('hide');
    event.stopPropagation();
});
$('table tbody tr td:nth-child(3) a').click(function(e){
	e.preventDefault();
	var that=$(this);
	   var id = that.parent().attr('data-id');
	   alert(id);
		$.ajax({
	        url: "switchIsUse",
	        type: "POST",                       //请求方式
	        dataType: "json",
	        success: function (result) {
	        	if(result.obj==0){
	        		that.removeClass('using');
	        		that.html('禁止');
	        	} else if(result.obj==1){
	        		that.addClass('using');
	        		that.html('启用');
	        	}
	        },
	        fail: function (result) {
	            // 此处放失败后执行的代码
	        }
	    });
});
$('table').on('click','button.delete',function(){
	var id = $(this).attr('data-id');
	console.log(id);
    $('#mask-box').css('display','block');
    $('#mask-box #remove-block').css('display','block');
    var that = $(this);
    var dataId = $(this).attr('data-id');
    $('#remove-block .queren').click(function(){
    	$.ajax({
  		  type: 'POST',
  		  url: "delOne",
  		  data: {id:dataId},
  		  dataType:'text',
  		  success: function (isSuccess){
  			that.parent().parent().remove();
  		  }
  		});
        $('#mask-box').css('display','none');
    });
});

$('#remove-block .cancel').click(function(){
    $('#mask-box').css('display','none');
});